<?php
 $dias = array('Lunes', 'Martes', 'Miércoles', 'Jueves', 'Viernes');
 $horas = array('06', '07', '08', '09', '10', '11',
                 '12', '13', '14', '15', '16', '17', 
                 '18', '19', '20', '21', '22');
?>
    <script type='text/javascript'>
       $(document).ready(function() { 
           $('#formulario').validate({
            rules:{
                'horariosCheckbox[]':{
                    required:true
                }
            },
            messages: {
               'horariosCheckbox[]':{
                   required: function(){
                        $('#msg').html('<div class="alert alert-error">\n\
                                            <button type="button" class="close" data-dismiss="alert">&times;</button>\n\
                                                <p class="text-error">ERROR! Se nececita por lo menos asignar una clase... <i class="icon-hand-up" /></p>\n\
                                        </div>');
                        return false;
                   }
               }
            },
            submitHandler: function(form){
                form.submit();
            },
            invalidHandler: function(){}
            });
       });
    </script>

    <div class="alert alert-info">
            <i class="icon-info-sign icon-large"></i>  <strong>Atención!</strong>, los días de actividades se asignarán a: <code><?php echo $Profesor;?></code>.
    </div>                      
    <form id="formulario" name="formulario" action="<?php echo $view['router']->generate('admin_clase_profesor_save', array('id' => $idProfesor)) ?>" 
          method="post" class='form-horizontal form-bordered form-validate'>                     
        <table id="table" class="table dataTable table-hover">
            <thead><tr>
                <th>Horarios</th>   
                <?php foreach ($dias as $dia) {?>
                    <th style="text-align: center;"><?php echo $dia;?></th>                                                                                           
                <?php
                }?>
            </tr></thead>
            <tbody>
                <?php for ($index1 = 0; $index1 < count($horas); $index1++) {?>
                <tr style="">
                    <th><?php echo $horas[$index1].":00";?></th>
                    
                    <?php for ($index2 = (5*$index1); $index2 < (5*$index1+5); $index2++) {?>
                        <td style="text-align: center;">
                            <label class='checkbox'>
                                <input type="checkbox" 
                                       <?php echo ($Clases[$index2]->getHabilitado()) ? "disabled='true'":"";?> 
                                       value="<?php echo $Clases[$index2]->getCodigoClase();?>" 
                                       name="horariosCheckbox[]">
                                <?php 
                                    if($Clases[$index2]->getHabilitado()){   
                                        echo $Clases[$index2]->getProfesor()->getPersona()->getNombre();
                                    }
                                ?>
                            </label>
                        </td>                                                    
                    <?php
                    }?>
                </tr>                      
                <?php
                }?>
            </tbody>
        </table>
        <div id="msg"></div>
        <div class="form-actions offset1">
            <input type="submit" class="button button-basic-blue" value="Aceptar">
            <button type="button" class="button button-basic">Cancelar</button>
        </div>
    </form>